//
//  LTFExclusiveCollectionViewCell.m
//  NeteaseNews
//
//  Created by liutaifeng on 16/4/26.
//  Copyright © 2016年 liutaifeng. All rights reserved.
//

#import "LTFExclusiveCollectionViewCell.h"
#import "LTFExclusiveView.h"

@interface LTFExclusiveCollectionViewCell ()
<
 LTFExclusiveViewDelegate
>
@property (nonatomic, retain) LTFExclusiveView *exclusiveView;
@end

@implementation LTFExclusiveCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView];
    }
    return self;
}
- (void)setString:(NSString *)string {
    if (_string != string) {
        [_string release];
        _string = [string retain];
        [self createData];
    }
}

- (void)createView {
    [super layoutSubviews];
    self.exclusiveView = [[LTFExclusiveView alloc] initWithFrame:CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 64 - 50)];
    [self.contentView addSubview:_exclusiveView];
    [_exclusiveView release];
    _exclusiveView.delegate = self;
    [self createData];
}
- (void)sendExclusiveAddress:(NSString *)address {
    [self.delegate sendHeadExclusiveString:address];
}
- (void)sendAddress:(NSString *)address {
    [self.delegate sendExclusiveString:address];
}
- (void)createData {
    self.exclusiveView.string = self.string;
}
- (void)layoutSubviews {
    self.exclusiveView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height - 64 - 50);
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
